package com.cx.bank.manager;


import com.cx.bank.exception.AccountOverDrawnException;
import com.cx.bank.exception.InvalidDepositException;
import com.cx.bank.pojo.User;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author jxau_scf
 * @date 2021/7/13 - 20:34
 */
public interface IManager {

    //查询方法
    Double inquiry(String userName) throws SQLException;

    //根据用户名查询用户
    User findUserByName(String userName) throws SQLException;

    //根据用户id查询用户信息
    User findUserByUserId(Integer userId) throws SQLException;

    //查询所有用户
    List<User> findAllUser() throws SQLException;

    //通过userId更新用户信息
    boolean updateUser(User user);

    //根据userId删除用户
    boolean deleteUserByUserId(Integer userId);

    //取款方法（实现“余额不足”逻辑判断）
    boolean withdrawals(String userName, Double money) throws InvalidDepositException, SQLException;

    //存款方法（实现“存款不能为负”逻辑判断）
    boolean deposit(String userName, double money) throws AccountOverDrawnException, SQLException;

    //退出系统方法
    void exitSystem() throws IOException;

    //注册
    boolean register(User user) throws SQLException;

    //登录
    boolean login(String userName, String password) throws SQLException;

    //冻结账户
    boolean frozenAccount(String myUserName, String userName, Integer userFlag) throws SQLException;

    //转账
    boolean transfer(String myUserName, String toUserName, double transferMoney) throws IOException, SQLException;

}
